package handler

import (
	"github.com/ce-exp/backend/mod/user/constant/code"
	"github.com/tsingshaner/gin/resp"
	v "github.com/tsingshaner/gin/validator"
)

type (
	RefreshTokenReqBody struct {
		RefreshToken string `json:"refreshToken" binding:"required"` // 刷新令牌
	}
)

func (h *handler) refreshTokenChain() Chain {
	return Chain{h.refreshToken}
}

func (h *handler) refreshToken(c Ctx) {
	body := v.GetBody[RefreshTokenReqBody]()
	user := h.Verify.Payload(c)

	resp.OK[string, any](c, code.Login)
}
